/**
 * 
 */
package cn.owen.config;

import java.util.HashMap;

import javax.servlet.annotation.WebListener;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;


/**容器内置作用域
 * @author Burning
 * @email wenbao163.good@163.com
 * @date 2016年12月1日下午10:31:44
 * 
 */
@WebListener
public class SessionListener implements HttpSessionListener   {
	
	public static HashMap<Integer,HttpSession> sessionMap = new HashMap<Integer,HttpSession>();  

	@Override
	public void sessionCreated(HttpSessionEvent httpSessionEvent) {
		 HttpSession session = httpSessionEvent.getSession();  
	}

	@Override
	public void sessionDestroyed(HttpSessionEvent httpSessionEvent) {
		 HttpSession session = httpSessionEvent.getSession();  
		  
	        delSession( session );  
	}

	  public static synchronized void delSession(HttpSession session)  
	    {  
	        if(session != null)  
	        {  
	  
	            // 删除单一登录中记录的变量  
	            if(session.getAttribute( "CUR_ACCOUNT" ) != null)  
	            {  
	            	/*TAccount account = (TAccount) session.getAttribute( "CUR_ACCOUNT" );  
	                SessionListener.sessionMap.remove(account.getId() );  */
	            }  
	        }  
	    }
	  
	  

}
